/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package isnmp.ui;


import java.util.List;
import javax.swing.table.AbstractTableModel;

import sg.simple.snmp.stats.TableData;


public class SNMPTableModel extends AbstractTableModel {


    TableData tableData;
    List<? extends TableData> tableRows;

    
    
    public SNMPTableModel(List<? extends TableData> r) {
        this.tableRows = r;
    }

    @Override
    public String getColumnName(int column) {
       
         String colName = "";
        
        if (!tableRows.isEmpty()){
            
            TableData row = tableRows.get(0);
          colName =  row.getPropertyName(column);
          
    }
        
        return colName;

    }




    @Override
    public int getRowCount() {
        return this.tableRows.size();
    }

    @Override
    public Object getValueAt(int row, int column) {
        TableData tableData = tableRows.get(row);
        return tableData.getCellData(column);
    
        }
    @Override
    public int getColumnCount() {
        
        int colCount  = 0;
        
        if (!tableRows.isEmpty()){
            
            TableData row = tableRows.get(0);
            
            colCount = row.getCellCount();
    }

        return colCount;
        
        
        
        }


}
